package com.initialize.pub.dao;

import com.initialize.pub.mybatis.plus.entity.Comments;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * User: jane
 * Date: 2020/4/29
 * Time: 1:12 下午
 * Description:
 */
@Repository
public interface CommentDAO {
    @Select({
            "SELECT\n" +
                    "\tcomments.add_the_time,\n" +
                    "\tcomments.`name`,\n" +
                    "\tcomments.content,\n" +
                    "\tcomments.`status` \n" +
                    "FROM\n" +
                    "\tcomments \n" +
                    "WHERE\n" +
                    "\tcomments.`status` = 1 \n" +
                    "ORDER BY\n" +
                    "\tcomments.add_the_time DESC \n" +
                    "\tLIMIT #{size}"
    })
    List<Comments> sortLimit(@Param("size") int size);
}